From d58ec581c107faf7b559ede26a1c09956df08760 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sat, 21 May 2005 10:42:50 +0000 Subject: [PATCH] bitkeeper revision 1.1504 (428f10aaD4iY_Mj4uu6RLDmF65qx-w) Fix memory scrubbing to deal with memguarded Xen heap pages. Signed-off-by: Keir Fraser --- xen/common/page_alloc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index c320d75174..72b25bd0ea 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -375,9 +375,19 @@ void scrub_heap_pages(void) /* Re-check page status with lock held. */ if ( !allocated_in_map(pfn) ) { - p = map_domain_mem(pfn << PAGE_SHIFT); - clear_page(p); - unmap_domain_mem(p); + if ( IS_XEN_HEAP_FRAME(pfn_to_page(pfn)) ) + { + p = page_to_virt(pfn_to_page(pfn)); + memguard_unguard_range(p, PAGE_SIZE); + clear_page(p); + memguard_guard_range(p, PAGE_SIZE); + } + else + { + p = map_domain_mem(pfn << PAGE_SHIFT); + clear_page(p); + unmap_domain_mem(p); + } } spin_unlock_irqrestore(&heap_lock, flags); -- 2.30.2